from service.userservice import UserService
from flask import Blueprint, request

user_bp = Blueprint('user_bp', __name__, url_prefix='/user')


class UserController:

    @staticmethod
    @user_bp.route('/getAllUser', methods=['GET'])
    def get_all_user():
        users = UserService.get_all_user()
        return {'code': 10000, 'data': users, 'message': 'success'}

    @staticmethod
    @user_bp.route('/addUser', methods=['POST'])
    def add_user():
        user = request.json
        UserService.add_user(user)
        return {'code': 10000, 'data': None, 'message': 'success'}

